#include "fusecpp.h"
#include "fileman.h"
#include "mvfs.h"
#include "config.h"
#include "kp.h"

static fuse_cpp::FuseDispatcher fuseDis;

FileManager *pMan;

int main(int argc, char* argv[])
{
    Config::Load("moss.cfg");

    pMan = new FileManager();
    pMan->addOnlineStorage(new KPOnlineStorage());

    pMan -> connect();

    fuseDis.set_open(MVFS::open);
    fuseDis.set_getattr(MVFS::getattr);
    fuseDis.set_read(MVFS::read);
    fuseDis.set_readdir(MVFS::readdir);
    fuseDis.set_mkdir(MVFS::mkdir);
    fuseDis.set_rmdir(MVFS::rmdir);
    fuseDis.set_rename(MVFS::rename);
    fuseDis.set_truncate(MVFS::truncate);
    fuseDis.set_write(MVFS::write);
    fuseDis.set_create(MVFS::create);
    fuseDis.set_release(MVFS::release);
    fuseDis.set_unlink(MVFS::unlink);
    
    fuseDis.set_init(MVFS::init);
    fuseDis.set_destroy(MVFS::destroy);

    int ret =  fuse_main(argc, argv, fuseDis.get_fuseOps(), NULL);
    return ret;
}
